<template>
  <el-dialog v-if="dialogVisiable" v-model="dialogVisiable" title="生成包线" width="800px">
    <el-form :model="queryParams" :rules="rules">
      <el-form-item label="包线类型" prop="">
        <el-select v-model="queryParams.type">
          <el-option v-for="(item, index) in types" :key="'type' + index" :label="item.label" :value="item.field" />
        </el-select>
      </el-form-item>
      <el-form-item label="载荷类型" prop="">
        <el-checkbox-group v-model="queryParams.type">
          <el-checkbox v-for="(item, index) in datas" :key="'type' + index" :label="item.label" :value="item.field" />
        </el-checkbox-group>
      </el-form-item>
      <el-form-item label="剪力选择" prop="">
        <el-checkbox-group v-model="queryParams.type">
          <el-checkbox v-for="(item, index) in datas" :key="'type' + index" :label="item.label" :value="item.field" />
        </el-checkbox-group>
      </el-form-item>
      <el-form-item label="弯矩选择" prop="">
        <el-checkbox-group v-model="queryParams.type">
          <el-checkbox v-for="(item, index) in datas" :key="'type' + index" :label="item.label" :value="item.field" />
        </el-checkbox-group>
      </el-form-item>
      <el-form-item label="扭矩选择" prop="">
        <el-checkbox-group v-model="queryParams.type">
          <el-checkbox v-for="(item, index) in datas" :key="'type' + index" :label="item.label" :value="item.field" />
        </el-checkbox-group>
      </el-form-item>
    </el-form>
    <template #footer>
      <div class="dialog-footer">
        <el-button @click="closeDialog">关闭</el-button>
        <el-button type="primary" @click="saveDialog">确定</el-button>
      </div>
    </template>
  </el-dialog>
</template>

<script setup name="SelectTaskDialog" lang="ts">
import { getExperimentList } from '@/api/loadProcessingAlgorithm/loadTaskManagement/index';
const dialogVisiable = ref(false);
const queryFormRef = ref<ElFormInstance>();
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const loading = ref(false);
const queryParams = reactive({
  taskName: '',
  loadType: '',
  stage: '',
  state: '已完成',
  version: '',
  pageNum: 1,
  pageSize: 10
});
const datas = ref([
  {
    label: '飞行载荷',
    field: 'first'
  },
  {
    label: '地面载荷',
    field: 'second'
  },
  {
    label: '动载荷',
    field: 'third'
  }
]);
const types = [
  {
    label: '机身包线',
    field: '1',
    shearForce: [
      {
        label: 'FY',
        field: 'fy'
      },
      {
        label: 'FZ',
        field: 'fz'
      }
    ],
    bendingMoment: [
      {
        label: 'MY',
        field: 'my'
      },
      {
        label: 'MZ',
        field: 'mz'
      }
    ],
    torque: [
      {
        label: 'MX',
        field: 'mx'
      }
    ]
  },
  {
    label: '左机翼包线',
    field: '2',
    shearForce: [
      {
        label: 'FX',
        field: 'fx'
      },
      {
        label: 'FY',
        field: 'fy'
      }
    ],
    bendingMoment: [
      {
        label: 'MY',
        field: 'my'
      }
    ],
    torque: [
      {
        label: 'MX',
        field: 'mx'
      },
      {
        label: 'MZ',
        field: 'mz'
      }
    ]
  },
  {
    label: '右机翼包线',
    field: '3',
    shearForce: [
      {
        label: 'FX',
        field: 'fx'
      },
      {
        label: 'FY',
        field: 'fy'
      }
    ],
    bendingMoment: [
      {
        label: 'MY',
        field: 'my'
      }
    ],
    torque: [
      {
        label: 'MX',
        field: 'mx'
      },
      {
        label: 'MZ',
        field: 'mz'
      }
    ]
  },
  {
    label: '左平尾包线',
    field: '4',
    shearForce: [
      {
        label: 'FX',
        field: 'fx'
      }
    ],
    bendingMoment: [
      {
        label: 'MX',
        field: 'my'
      }
    ],
    torque: [
      {
        label: 'MZ',
        field: 'mz'
      }
    ]
  },
  {
    label: '右平尾包线',
    field: '5',
    shearForce: [
      {
        label: 'FX',
        field: 'fx'
      }
    ],
    bendingMoment: [
      {
        label: 'MX',
        field: 'my'
      }
    ],
    torque: [
      {
        label: 'MZ',
        field: 'mz'
      }
    ]
  },
  {
    label: '垂尾包线',
    field: '6',
    shearForce: [
      {
        label: 'FZ',
        field: 'fz'
      }
    ],
    bendingMoment: [
      {
        label: 'MX',
        field: 'my'
      }
    ],
    torque: [
      {
        label: 'MY',
        field: 'my'
      }
    ]
  }
];
const rules = reactive({
  loadType: [{ required: true, message: '包线不能为空', trigger: 'change' }],
  loadName: [{ required: true, message: '载荷选择不能为空', trigger: 'change' }]
});
const closeDialog = () => {
  dialogVisiable.value = false;
};
const openDialog = async (type) => {
  dialogVisiable.value = true;
};
defineExpose({
  openDialog
});
</script>

<style lang="scss" scoped>
.dialog-footer {
  text-align: center;
}
</style>
